using System;
using System.Text;
using System.Windows.Forms;
namespace My12306
{
	public class ComboBoxEx : ComboBox
	{
		protected override void OnTextUpdate(EventArgs e)
		{
			BindingSource bindingSource = base.DataSource as BindingSource;
			bindingSource.Filter = string.Format("Text like '{0}%' or SID like '{0}%'", this.Text);
			base.DroppedDown = true;
			this.Cursor = Cursors.Default;
			base.OnTextUpdate(e);
		}
		public static string GetChineseSpell(string strText)
		{
			int length = strText.Length;
			string text = "";
			for (int i = 0; i < length; i++)
			{
				text += ComboBoxEx.getSpell(strText.Substring(i, 1));
			}
			return text;
		}
		public static string getSpell(string cnChar)
		{
			byte[] bytes = Encoding.Default.GetBytes(cnChar);
			string result;
			if (bytes.Length > 1)
			{
				int num = (int)bytes[0];
				int num2 = (int)bytes[1];
				int num3 = (num << 8) + num2;
				int[] array = new int[]
				{
					45217, 
					45253, 
					45761, 
					46318, 
					46826, 
					47010, 
					47297, 
					47614, 
					48119, 
					48119, 
					49062, 
					49324, 
					49896, 
					50371, 
					50614, 
					50622, 
					50906, 
					51387, 
					51446, 
					52218, 
					52698, 
					52698, 
					52698, 
					52980, 
					53689, 
					54481
				};
				for (int i = 0; i < 26; i++)
				{
					int num4 = 55290;
					if (i != 25)
					{
						num4 = array[i + 1];
					}
					if (array[i] <= num3 && num3 < num4)
					{
						result = Encoding.Default.GetString(new byte[]
						{
							(byte)(65 + i)
						});
						return result;
					}
				}
				result = "*";
			}
			else
			{
				result = cnChar;
			}
			return result;
		}
	}
}
